<template>
  <div class="mt-4 ml-4">
    <el-auto-complete
      v-model="value"
      :fetch-suggestions="querySearch"
      placeholder="请输入内容"
      @select="handleSelect"
      :highlight-first-item="true"
    ></el-auto-complete>
  </div>
</template>

<script setup>
const querySearch = (queryString, cb) => {
  let array = []
  if (queryString.length > 0) {
    array.push({ value: queryString })
  }
  array.push(...[{ value: '衣服' }, { value: '帽子' }, { value: '鞋子' }])
  cb(array)
}
const handleSelect = (item) => {
  console.log(item)
}
</script>
